﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Reflection.Emit;
using FoneBuddy.LinqModel;
using FoneBuddy.LinqModel.Data;
using FoneBuddy.LinqData;


public partial class Default3 : System.Web.UI.Page
{
    public class CountryInfo
    {
        public int CountryId { get; set; }
        public string CountryName { get; set; }
    }

    [Serializable]
    public enum FlagsType
    {
        Color = 1,
        Size = 2
    }
    public List<CountryInfo> CountryInformation { get; set; }
    [WebMethod]
    public static List<CountryInfo> LoadCountry()
    {
        CountryInfo ci = new CountryInfo();
        List<CountryInfo> CountryInformation = new List<CountryInfo>();
        DataSet ds;
        using (SqlConnection con = new SqlConnection("Data Source=candour-pc;User Id=test;Password=test;DataBase=FoneBuddy"))
        {
            using (SqlCommand cmd = new SqlCommand("select * from filtermaster", con))
            {
                con.Open();
                cmd.Connection = con;
                cmd.CommandType = CommandType.Text;
                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                {
                    ds = new DataSet();
                    da.Fill(ds);
                }
            }
        }
        try
        {
            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            CountryInformation.Add(new CountryInfo()
                            {
                                CountryId = Convert.ToInt32(dr["Id"]),
                                CountryName = dr["Name"].ToString()
                            });
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return CountryInformation;
    }
    private void teting()
    {
        //chooseSector11.DataSource = "";
        //chooseSector11.DataBind();
        
        
    }
    protected void OnServer(object sender,EventArgs e)
    {
        
        Page.ClientScript.RegisterStartupScript(GetType(), "", "check();");
        return ;
    }
    protected void Page_Load(object sender,EventArgs e)
    {

    }
    //protected void Page_Load(object sender,EventArgs e)
    //{

    //}
    [System.Web.Services.WebMethod]
    public static string[] checkMail()
    {
        //IDataRepository _dataObject = new DataRepository();
        //Merchant merchant = new Merchant();
        //merchant = new Merchant(_dataObject);
        //merchant.Email = EmailId;
        //merchant.GetMerchantByEmailId();
        //if (merchant.Id > 0)
        //    return true;
        //else
        //    return false;
        string[] a = new string[5];
        a[0] = "1";
        return a;
    }

}
